Differences Between Rural and Urban School Districts (3 of 3)
studentsPerT = folium.Map([38.318364, -92.412253], tiles='CartoDB Positron', zoom_start=6.5)
# generate choropleth map
choropleth = folium.Choropleth(
geo_data=districts,
data=districts,
columns=['NAME', 'StudentsPerTeacherDistrictAVG'],
key_on='feature.properties.NAME',
fill_color='Reds',
fill_opacity=1,
line_opacity=1,
legend_name='Average Number of Students Per Teacher',
highlight=True,
smooth_factor=0).add_to(studentsPerT)
# add labels for school district and miles per school.
style_function = "font-size: 15px; font-weight: bold"
choropleth.geojson.add_child(
folium.features.GeoJsonTooltip(['NAME', 'StudentsPerTeacherDistrictAVG'], style=style_function, labels=False))
# create a layer control
folium.LayerControl().add_to(studentsPerT)
studentsPerT